Completed
Push — master ( 95de79...31de30 )
by Askupa
02:40
created

$(ꞌ#settings-searchꞌ).keyup   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
nc 3
nop 1
dl 0
loc 23
rs 9.0856
c 1
b 0
f 0
1
(function(){
2
    var $fields = $('.amarkal-settings-field');
3
    
4
    $('#settings-search').on('keyup',function(e){
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
5
        var query    = $(this).val().toLowerCase(),
6
            matches  = [];
7
            
8
        if(query.length > 1) {
9
            $fields.hide().each(function(){
10
                var $field = $(this),
11
                    title  = $field.attr('data-title').toLowerCase();
12
                    
13
                if(title.match(query)){
14
                    matches.push($field);
15
                }
16
            });
17
            
18
            $(matches).map(function(){return this.toArray();}).show();
19
            
20
            $('#settings-search-results').text(matches.length ? matches.length+' settings found' : 'Nothing found');
21
        }
22
        else {
23
            $fields.show();
24
            $('#settings-search-results').text('');
25
        }
26
    });
27
})();